package com.aa.studentmanage.utils;

import java.util.InputMismatchException;
import java.util.Scanner;

public class InputHelper {
    public static int getInt(){
        Scanner input = new Scanner(System.in);
//      输入的不是数值,继续输入
        int num;
        while(true){
            try{
                input = new Scanner(System.in);
                num = input.nextInt();
                break;
            }catch (InputMismatchException e){
                System.out.println("输入的必须是数值,请重新输入:");
            }
        }
        return num;
    }

    public static String getString(){
        Scanner input = new Scanner(System.in);
        return input.next();
    }
}
